#include <vector>
#include <iostream>

using namespace std;

int ways(vector<vector<int>> path) {
  

  if (path.size() == 13) {
    return 1;
  }

  vector<vector<int>> directions {
    {0, 1}, {1, 0}, {0, -1}, {-1, 0}
  };

  int count = 0;
  
  for (auto d : directions) {
    int lastX = path.back()[0];
    int lastY = path.back()[1];

    vector<int> next = {d[0] + lastX, d[1] + lastY};

    if (find(path.begin(), path.end(), next) == path.end()) {
      vector<vector<int>> path_copy = path;
      path_copy.push_back(next);
      count += ways(path_copy);
    }
  }

  return count;
}

int main(int argc, char const *argv[])
{
  /* code */
  cout << ways({{0, 0}}) << endl;
  return 0;
}
